package com.example.satoken.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.example.satoken.model.MtoUser;
import com.example.satoken.service.MtoUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author:ZhouYang
 * @Description:
 * @Date: Created in 2020/9/15 10:06
 * @Modified By：
 */
@RequestMapping("/user")
@RestController
public class UserController {


    @Autowired
    private MtoUserService userService;

    @GetMapping
    public List<MtoUser> test(){
        List<MtoUser> mtoUsers =  userService.findAll();
        return mtoUsers;
    }
    @GetMapping("/test")
    public List<MtoUser> test1(){
        StpUtil.setLoginId(1);
        boolean login = StpUtil.isLogin();

        Object loginId = StpUtil.getLoginId();
        
        List<MtoUser> mtoUsers =  userService.findAll();
        return mtoUsers;
    }
}
